import Hello from './component/Hello.vue'
import Counter from './component/Counter.vue'
import User from './component/User.vue'


import UserProfile from './component/UserProfile.vue'
import UserPosts from './component/UserPosts.vue'



const routes = [
    { path: '/hello', component: Hello },  //简单路径型
    { path: '/counter', component: Counter }, //简单路径型
    { path: '/user/:id', component: User,
        children: [
            {
                // 当 /user/:id/profile 匹配成功，
                // UserProfile 会被渲染在 User 的 <router-view> 中
                path: 'profile',
                component: UserProfile
            },
            {
                // 当 /user/:id/posts 匹配成功
                // UserPosts 会被渲染在 User 的 <router-view> 中
                path: 'posts',
                component: UserPosts
            }
        ]

    } //简单路径型

]


// 3. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
 const router = new VueRouter({
    routes:routes // （缩写）相当于 routes: routes
})

export default router;
